export const isEmpty = function (val: any): boolean {
  // null or undefined
  if (val == null) return true;
  // boolean
  if (typeof val === 'boolean') return false;
  // number
  if (typeof val === 'number') return !val;
  // Error
  if (val instanceof Error) return val.message === '';
  // 根据知名符判断
  switch (Object.prototype.toString.call(val)) {
    // String or Array
    case '[object String]':
    case '[object Array]':
      return !val.length;

    // Map or Set or File
    case '[object File]':
    case '[object Map]':
    case '[object Set]': {
      return !val.size;
    }
    // Plain Object
    case '[object Object]': {
      return !Object.keys(val).length;
    }
  }

  return false;
};